package cn.jhc;

import java.io.IOException;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestHandler;

/**
 * Root request handler.
 * @author luyanfei
 */
public class RootRequestHandler implements HttpRequestHandler {

    @Override
    public void handle(HttpRequest request, HttpResponse response, HttpContext context)
            throws HttpException, IOException {
        final String hello = "<html><body><h1>Hello Web!</h1></body></html>";
        StringEntity resEntity = new StringEntity(hello, ContentType.create("text/html", "utf-8"));
        response.setEntity(resEntity);
    }

}
